package cn.tedu._05mvcboot01.controller;

import cn.tedu._05mvcboot01.pojo.dto.WeicehatDto;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

@Controller
public class UserController {

    @RequestMapping(value = "/v1/users/login")
    @ResponseBody
    public String login(){

        return "恭喜你登陆成功";
    }

    @RequestMapping(value = "/v1/users/reg")
    @ResponseBody
    public String register(HttpServletRequest request){
        String username = request.getParameter("username");
        String password = request.getParameter("password");

        return username+"-"+password;
    }


    @RequestMapping(value = "/v1/users/pwd")
    @ResponseBody
    public String changePwd(String username ,String newpwd ){
        return "账号"+username+"-"+"密码"+newpwd;
    }

    @RequestMapping(value = "/v1/users/wechat")
    @ResponseBody
    public String weiChat(WeicehatDto weicehatDto){
        String name=weicehatDto.getName();
        String pwd=weicehatDto.getPwd();



        return name+"-"+pwd ;
    }





}
